﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HerGoS.Interfaces.Observer;

namespace HerGoS.Administration.Engine
{
    public class CheckApplicationStart : IObserver
    {
        public void RunEvent()
        {
            //Evento para ejecutar antes de iniciar la aplicacion
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
            smtp.Credentials = new System.Net.NetworkCredential("xxx@gmail.com", "xxxx");
            message.From = new System.Net.Mail.MailAddress("hernanjh@gmail.com");
            message.To.Add(new System.Net.Mail.MailAddress("hernanjh@gmail.com"));

            message.Subject = "Inicio de la Aplicacion";
            message.Body = "Body  " + DateTime.Now.ToString();
            message.IsBodyHtml = false;

            smtp.EnableSsl = true;
            //smtp.Send(message);
        }
    }

    public class CheckSessionEnd : IObserver
    {
        public void RunEvent()
        {
            //Evento para ejecutar al finalizar la session
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
            smtp.Credentials = new System.Net.NetworkCredential("xxx@gmail.com", "xxx");
            message.From = new System.Net.Mail.MailAddress("hernanjh@gmail.com");
            message.To.Add(new System.Net.Mail.MailAddress("hernanjh@gmail.com"));

            message.Subject = "Logout de la Aplicacion";
            message.Body = "Body  " + DateTime.Now.ToString();
            message.IsBodyHtml = false;

            smtp.EnableSsl = true;
            //smtp.Send(message);
        }
    }

}
